package com.fit.piris.pages.fanpage;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.fit.piris.dao.fanpage.FanPageDAO;
import com.fit.piris.entities.fanpage.FanPage;
import com.fit.piris.pages.ErrorPage;

public class Add {

	@Property
	private FanPage fanPage;
	@Inject
	private FanPageDAO fanPageDAO;
	@InjectPage
	private ErrorPage errorPage;

	Object onSuccess() {
		try {
			fanPageDAO.save(fanPage);
			return Browse.class;
		} catch (Exception e) {
			errorPage.setMessage("Greska prilikom dodavanja zapisa! ");
			return errorPage;
		}

	}

	
}
